<template>
    <div>
        <div class="select-btn-group">
            <el-button :size="size" @click="selectAll">{{$t('m.label.allAddDelSelectAll')}}</el-button>
            <el-button :size="size" @click="selectDel">{{$t('m.label.allAddDelSelectDel')}}</el-button>
        </div>
        <div class="select-height"></div>
    </div>
</template>
<script>
export default {
    props: {
        selectForm: Object,
        selectArray: Array,
        selectArrayId: String,
        selectFormId: String,
        size: {
            type:String,
            default:'mini'
        }
    },
    methods: {
        // 全部选中
        selectAll() {
            this.selectForm[this.selectFormId] = this.selectArray.map(item =>
                this.selectArrayId ? item[this.selectArrayId] : item
            );
            this.$emit("selectAll");
        },
        // 全部删除
        selectDel() {
            this.selectForm[this.selectFormId] = [];
            this.$emit("selectDel");
        }
    }
};
</script>
<style lang="stylus" scoped>
.select-btn-group {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    padding: 10px 0;
    background: #ffffff;
    z-index: 9;
    display: flex;
    justify-content: space-around;

    .el-button {
        margin: 0;
        padding: 7px 10px;
    }
}

.select-height {
    height: 48px;
}
</style>
